import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:seedfour/app/constants.dart';

import '../../../models/case_detail_entity.dart';

class CaseDetailState {
  var caseStatus = 0.obs;
  var caseDetail = Rxn<CaseDetailEntity>();

  var caseInfoList = <CaseDetailSubItemInfo>[].obs;
  var casePersonList = <CaseDetailItemInfo>[].obs;
  var caseApproveList = <CaseApproveRecord>[].obs;
  var caseContractList = <CaseContractFile>[].obs;
  var incomeOrderList = <CaseOrder>[].obs;
  var paidOrderList = <CaseOrder>[].obs;

  var unselectIncomeOrders = <CaseOrder>[].obs;
  var selectedIncomeOrderIds = <String>[].obs;

  var unselectPaidOrders = <CaseOrder>[].obs;
  var selectedPaidOrderIds = <String>[].obs;

  var isLoading = true.obs;

  // 实付总额
  var totalPaid = 0.0.obs;

  // 押金
  var deposit = 0.0.obs;

  var incomeOrderStartTime = 0.obs;
  var incomeOrderEndTime = 0.obs;

  var paidOrderStartTime = 0.obs;
  var paidOrderEndTime = 0.obs;

  CaseDetailState() {
    int now = DateTime.now().millisecondsSinceEpoch;
    incomeOrderEndTime.value = now - (now % dayInMilliseconds);
    incomeOrderStartTime.value =
        incomeOrderEndTime.value - dayInMilliseconds * 30 * 3;

    paidOrderEndTime.value = now - (now % dayInMilliseconds);
    paidOrderStartTime.value = paidOrderEndTime.value - dayInMilliseconds * 30 * 3;
  }
}

class CaseDetailParams {
  final String caseId;
  final int caseStatus;

  CaseDetailParams({
    required this.caseId,
    required this.caseStatus,
  });
}

class CaseDetailItemInfo {
  String title;
  List<dynamic> subItemList;

  CaseDetailItemInfo({
    required this.title,
    required this.subItemList,
  });
}

class CaseDetailSubItemInfo {
  String title;
  String content;
  Color contentColor;

  CaseDetailSubItemInfo({
    required this.title,
    required this.content,
    this.contentColor = Colors.black87,
  });
}
